function getRoleByUser() {
    var roles = "AAA";
    var userId = getWebUser().getId();
    var fzrBoxValue = getItemValueAsString("dzxqdfzr");
    if (fzrBoxValue.indexOf(userId) > -1) {
        roles = "FZR"
    } else {
        var xqbmBoxValue = getItemValueAsString("xqtcbm_pgry");
        var sjbmBoxValue = getItemValueAsString("sjbm_pgry");
        var kfbmBoxValue = getItemValueAsString("kfgs_pgry");
        var ywbmBoxValue = getItemValueAsString("ywbm_pgry");
        if (xqbmBoxValue.indexOf(userId) > -1) {
            roles = roles + ",XQTC";
        }
        if (sjbmBoxValue.indexOf(userId) > -1) {
            roles = roles + ",SJBM";
        }
        if (kfbmBoxValue.indexOf(userId) > -1) {
            roles = roles + ",KFBM";
        }
        if (ywbmBoxValue.indexOf(userId) > -1) {
            roles = roles + ",YWBM";
        }
    }
    return roles;
}

var myRoles = getRoleByUser();
var canSee = getItemValueAsString("plxgxx");
var status = "none";
if ("打开".equals(canSee)) {
    status = "table-row";
}
var script =
    "<script> " +
    "var flag = true; " +
    "var userAgentInfo = navigator.userAgent;" +
    "var Agents = ['Android', 'iPhone','SymbianOS','Windows Phone', 'iPad', 'iPod']; " +
    "flag = userAgentInfo.indexOf('Android') > -1 || userAgentInfo.indexOf('iPhone') > -1 || userAgentInfo.indexOf('SymbianOS') > -1 || userAgentInfo.indexOf('Windows Phone') > -1 || userAgentInfo.indexOf('iPad') > -1 || userAgentInfo.indexOf('iPod') > -1 ? false : true;" +
    "if(flag) {" + //PC客户端的逻辑
    "   var array = document.getElementsByClassName('tr-hide-Tab-splite-fzr'); " + //1. 首先隐藏所有
    "   for (var i = 0; i < array.length; i++) {" +
    "       array[i].style.display = 'none'; " +
    "   }";
//2. 根据不同角色选择效果
if ("FZR".equals(myRoles)) {
    script = script + " var array1 = document.getElementsByClassName('tr-hide-Tab-splite-fzr'); " +
        "               for (var i = 0; i < array1.length; i++) {" +
        "                   array1[i].style.display = '" + status + "'; " +
        "               }";
} else {
    if (myRoles.indexOf("XQTC") > -1) {
        script = script + " var array2 = document.getElementsByClassName('tr-hide-Tab-splite-xq'); for (var i = 0; i < array2.length; i++) {";
        script = script + " array2[i].style.display = '" + status + "'; ";
        script = script + " } ";
    }
    if (myRoles.indexOf("SJBM") > -1) {
        script = script + " var array3 = document.getElementsByClassName('tr-hide-Tab-splite-sj'); for (var i = 0; i < array3.length; i++) {";
        script = script + " array3[i].style.display = '" + status + "'; ";
        script = script + "  } ";
    }
    if (myRoles.indexOf("KFBM") > -1) {
        script = script + " var array4 = document.getElementsByClassName('tr-hide-Tab-splite-kf'); for (var i = 0; i < array4.length; i++) {";
        script = script + " array4[i].style.display = '" + status + "'; ";
        script = script + "  } ";
    }
    if (myRoles.indexOf("YWBM") > -1) {
        script = script + " var array5 = document.getElementsByClassName('tr-hide-Tab-splite-yw'); for (var i = 0; i < array5.length; i++) {";
        script = script + " array5[i].style.display = '" + status + "'; ";
        script = script + " }  ";
    }
}
script = script + "} else {"; //移动端的逻辑
script = script +
    "   var box = document.getElementById('11e8-5d8f-2e14c699-9108-3b55bb55f71e_divid');" +
    "   for (var t = 0; t < 19; t++) {" +
    "       box.style.display = 'none';" +
    "       box = box.nextElementSibling;}";
if ("FZR".equals(myRoles)) {
    script = script +
        "   var box = document.getElementById('11e8-5d8f-2e14c699-9108-3b55bb55f71e_divid');" +
        "   for (var t = 0; t < 19; t++) {" +
        "       box.style.display = '" + status + "';" +
        "       box = box.nextElementSibling;}";
} else {
    if (myRoles.indexOf("XQTC") > -1) {
        script = script +
            "   var box1 = document.getElementById('11e8-3ee6-a7206b53-8322-274e86807188_divid');" +
            "   var box2 = document.getElementById('11e8-3ee9-e298b2ac-8322-274e86807188_divid');" +
            "   var box3 = document.getElementById('11e8-5261-f10a4e99-802e-31f8afebe674_divid');" +
            "   var box4 = document.getElementById('11e8-3ee2-158308f6-8322-274e86807188_divid');" +
            "   box1.style.display = '" + status + "';" +
            "   box2.style.display = '" + status + "';" +
            "   box3.style.display = '" + status + "';" +
            "   box4.style.display = '" + status + "';";
    }
    if (myRoles.indexOf("SJBM") > -1) {
        script = script +
            "   var box = document.getElementById('11e8-3ee9-a7b3f196-8322-274e86807188_divid');" +
            "   for (var t = 0; t < 8; t++) {" +
            "       box.style.display = '" + status + "';" +
            "       box = box.nextElementSibling;}" +
            "   var boxbtn = document.getElementById('11e8-3ee2-158308f6-8322-274e86807188_divid');" +
            "   boxbtn.style.display = '" + status + "';";
    }
    if (myRoles.indexOf("KFBM") > -1) {
        script = script +
            "   var box1 = document.getElementById('11e8-5265-67805bc5-802e-31f8afebe674_divid');" +
            "   var box2 = document.getElementById('11e8-63f3-420f1ef7-8df9-7983d259a887_divid');" +
            "   var box3 = document.getElementById('11e8-3ee2-158308f6-8322-274e86807188_divid');" +
            "   box1.style.display = '" + status + "';" +
            "   box2.style.display = '" + status + "';" +
            "   box3.style.display = '" + status + "';";
    }
    if (myRoles.indexOf("YWBM") > -1) {}
}
script = script + " }</script>";
println(script);
script;